package main;

import java.util.ArrayList;
import java.util.GregorianCalendar;

import gui.StartFrame;



/**
 * ManusviewMain
 * 
 * Cristopher added conference initialization code, removed calls to addRole(author)
 * because of added business rule
 * Holly added more conference initialization code
 * @author Daniel Anderson
 * @version 12/3
 */
public class ManuviewMain {
	/**
	 * The main method for ManuveiwMain creates a new StartFrame,
	 * then starts the program.
	 * @param args String Arguments are not utilized in ManuviewMain
	 */
	public static void main(String args[]){
		//setConferenceObjects();
	
	    final StartFrame gui = new StartFrame();
	    gui.start();
	}//end of main
	
	private static void setConferenceObjects() {
		GregorianCalendar dead1 = new GregorianCalendar(2011,12,5);
		GregorianCalendar dead2 = new GregorianCalendar(2012,3,5);
		Conference conf0 = new Conference("conf0", dead1, dead2, 
				new ArrayList<Manuscript>(), new ArrayList<User>());
		Conference conf1 = new Conference("conf1", dead1, dead2, 
				new ArrayList<Manuscript>(), new ArrayList<User>());
		Conference conf2 = new Conference("conf2", dead1, dead2, 
				new ArrayList<Manuscript>(), new ArrayList<User>());
		
		conf0.addUser(new User("abc@gmail.com", "Joe Smith"));
		conf0.addUser(new User("xyz@gmail.com", "Bob Names"));
		conf0.addUser(new User("qqq@gmail.com", "Lonely Jones"));
		conf0.getUsers().get(0).addRole(Roles.PROGRAMCHAIR);
		conf0.getUsers().get(0).addRole(Roles.REVIEWER);
		
		conf1.addUser(new User("abc@gmail.com", "Joe Smith"));
		conf1.addUser(new User("bec@msn.com", "Becca Middleton"));
		conf1.addUser(new User("abe@gmail.com", "Abe Matthews"));
		conf1.getUsers().get(0).addRole(Roles.REVIEWER);
		conf1.getUsers().get(0).addRole(Roles.PROGRAMCHAIR);
		conf1.getUsers().get(1).addRole(Roles.REVIEWER);
		conf1.getUsers().get(2).addRole(Roles.REVIEWER);
		Manuscript man1 = new Manuscript("Manuscript 1", "Joe Smith", 
											"abc@gmail.com", "text1");
		
		//TODO can we replace these if statements with something else?
		//If josh wants to regenerate different serialized objects, 
		//they may be confusing
		if (!man1.getAuthorID().equals("bec@msn.com")){
			man1.addReviewer("bec@msn.com");
		}
		if (!man1.getAuthorID().equals("abe@gmail.com")){
			man1.addReviewer("abe@gmail.com");
		}
		
		Manuscript man2 = new Manuscript("Manuscript 2", "Abe Matthews", 
											"abe@gmail.com", "text2");
		if (!man2.getAuthorID().equals("bec@msn.com")){
			man2.addReviewer("bec@msn.com");
		}
		Manuscript man3 = new Manuscript("Manuscript 3", "Becca Middleton", 
											"bec@msn.com", "text3");
		if (!man3.getAuthorID().equals("abe@gmail.com")){
			man3.addReviewer("abe@gmail.com");
		}
		conf1.addManuscript(man1);
		conf1.addManuscript(man2);
		conf1.addManuscript(man3);

			
		
		conf2.addUser(new User("xyz@gmail.com", "Bob Names"));
		conf2.addUser(new User("abc@gmail.com", "Joe Smith"));
		conf2.addUser(new User("bec@msn.com", "Becca Middleton"));
		conf2.addUser(new User("abe@gmail.com", "Abe Matthews"));
		conf2.getUsers().get(0).addRole(Roles.PROGRAMCHAIR);
		conf2.getUsers().get(0).addRole(Roles.REVIEWER);
		conf2.getUsers().get(3).addRole(Roles.REVIEWER);
		
		Manuscript man4 = new Manuscript("Manuscript 4", "Joe Smith", 
											"abc@gmail.com", "text4");
		if (!man4.getAuthorID().equals("abe@gmail.com")){
			man4.addReviewer("abe@gmail.com");
		}
		Manuscript man5 = new Manuscript("Manuscript 5", "Abe Matthews", 
											"abe@gmail.com", "text5");
		if (!man4.getAuthorID().equals("xyz@gmail.com")){
			man5.addReviewer("xyz@gmail.com");
		}
		
		Manuscript man6 = new Manuscript("Manuscript 6", "Becca Middleton", 
											"bec@msn.com", "text6");
		if (!man6.getAuthorID().equals("abe@gmail.com")){
			man6.addReviewer("abe@gmail.com");
		}
		
		conf2.addManuscript(man4);
		conf2.addManuscript(man5);
		conf2.addManuscript(man6);
		
		conf0.save();
		conf1.save();
		conf2.save();
	}
}//end of ManuviewMain
